<template>
  <div>
    <div v-if="errorState!==0">
      <frontend-error-page-std></frontend-error-page-std>
    </div>
    <router-view v-else />
  </div>
  <njt-message-box></njt-message-box>
  <error-list-display></error-list-display>
  <single-input-box></single-input-box>
</template>
<script lang="ts">

import {defineComponent} from 'vue'
import {PackageInfoDef, NjtPackInfoDef} from './lib/defs/comm'
import {prepareNotify} from './lib/helper/ui'

import packageJson from '../package.json'

export default defineComponent({
  name: 'App',
  setup() {
    // 获取package.json的任务只能放在项目中，不能放在lib中
    const njtPackInfo: NjtPackInfoDef = packageJson.njtconfig
    const packageInfo: PackageInfoDef = {
      njtconfig: njtPackInfo,
      productName: packageJson.productName,
      version: packageJson.version,
      copyrightYear: new Date().getFullYear().toString()
    }
    $f.packageInfo = packageInfo

    // 特殊处理: 由于useQuasar必须要在setup()中调用才有效，对notify的初始化需要放在这里
    prepareNotify()

    return {
      errorState: $f.errorState
    }
  }
})
</script>
